package com.hl.shifangzhiyu.mapper;

import com.hl.shifangzhiyu.pojo.Consultants;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
/**
* @author Administrator
* @description 针对表【consultants】的数据库操作Mapper
* @createDate 2025-06-06 15:40:24
* @Entity com.hl.shifangzhiyu.pojo.Consultants
*/
public interface ConsultantsMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Consultants record);

    int insertSelective(Consultants record);

    @Select("SELECT * FROM consultants WHERE consultant_id = #{consultant_id}")
    Consultants selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Consultants record);

    int updateByPrimaryKey(Consultants record);


    @Select("<script>" +
            "SELECT * FROM consultants WHERE 1=1 " +
            "<if test='tags != null and tags.size() > 0'>" +
            "AND (" +
            "<foreach collection='tags' item='tag' separator=' OR '>" +
            "(tag1 = #{tag} OR tag2 = #{tag} OR tag3 = #{tag})" +
            "</foreach>" +
            ")" +
            "</if>" +
            "<if test='level != null'> or level = #{level} </if>" +
            "<if test='sex != null'> OR sex = #{sex} </if>" +
            "</script>")
    List<Consultants> findByFilters(@Param("tags") List<String> tags,
                                   @Param("level") String level,
                                   @Param("sex") String sex);


}
